//
//  RNOLFundsDetailTabBarController.m
//  RongNiuOnline
//
//  Created by apple on 2018/4/13.
//  Copyright © 2018年 rongniu. All rights reserved.
//

#import "RNOLFundsDetailTabBarController.h"
#import "RNOLFundsRecordListViewController.h"
#import "RNOLMoneyManagerRecordListViewController.h"
#import "RNOLCommissionRecordListViewController.h"
#import "RNOLNavigationController.h"
#import <UINavigationController+FDFullscreenPopGesture.h>

@interface RNOLFundsDetailTabBarController ()


@end

@implementation RNOLFundsDetailTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = kBgColor ;
    [self createTabSubViewControllers];
    self.tabBar.tintColor = kAppMainColor;
    [self.tabBar setBackgroundImage: [UIImage imageNamed:@"tabbar_bg"]];
    //去掉tabBar顶部线条
    [UITabBar appearance].clipsToBounds = YES;
    [RNOLLoginTool setNavgationBarNeedAnimation:YES];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.fd_interactivePopDisabled = NO;
    [self.navigationController setNavigationBarHidden:YES animated:YES];
//    [self setStatusBarBackgroundColor: [kAppMainColor colorWithAlphaComponent:1]];

}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    self.fd_interactivePopDisabled = YES;
    [self.navigationController setNavigationBarHidden:NO animated:YES];
//    [self setStatusBarBackgroundColor: [UIColor colorWithWhite:0.35 alpha:0.35]];
}


- (void)createTabSubViewControllers{
    
    RNOLFundsRecordListViewController *fundsListVC = [[RNOLFundsRecordListViewController alloc] init];
    [self createNavgationViewControllerWithSubViewController: fundsListVC title: @"资金记录" image:@"rnol_home_normal" selectedImage:@"rnol_home_selected"];
    
    RNOLMoneyManagerRecordListViewController *moneyManagerListVC = [[RNOLMoneyManagerRecordListViewController alloc] init];
    [self createNavgationViewControllerWithSubViewController: moneyManagerListVC title: @"理财记录" image:@"rnol_discover_normal" selectedImage:@"rnol_discover_selected"];
    
    RNOLCommissionRecordListViewController *commissionListVC = [[RNOLCommissionRecordListViewController alloc] init];
    [self createNavgationViewControllerWithSubViewController: commissionListVC title: @"佣金记录" image:@"rnol_me_normal" selectedImage:@"rnol_me_selected"];
}


- (void )createNavgationViewControllerWithSubViewController:(UIViewController *)subVC
                                                      title:(NSString *)title
                                                      image:(NSString *)image
                                              selectedImage:(NSString *)selectedImage{
    RNOLNavigationController *wgbNavVC = [[RNOLNavigationController alloc] initWithRootViewController: subVC];
    subVC.navigationItem.title = title;
    subVC.tabBarItem.title = title;
    subVC.tabBarItem.image = [UIImage imageNamed: image];
    subVC.tabBarItem.selectedImage = [UIImage imageNamed: selectedImage] ;
    [self addChildViewController: wgbNavVC];
}


@end
